#pragma once

class CResourceMng
{
public:
	CResourceMng(void);
	~CResourceMng(void);

	int CResourceMng::InitH3Resource( xgc_lpcstr path );

	hgeSprite* GetSprite( xgc_lpcstr filename );

	HTEXTURE GetAnimation( xgc_lpcstr filename );
private:
	struct LodEntry 
	{
		char filename[16];
		unsigned int offset;			/* little endian */
		unsigned int uncompressedSize;	/* little endian */
		unsigned int unused;			/* little endian */
		unsigned int size;				/* little endian */
	};

	enum eResType { LOD_GRAPHICS, LOD_TEXT, LOD_SPRITE };

	typedef std::map< std::string, hgeSprite > SpriteMap; 
	SpriteMap smap;

	typedef std::map< std::string, xgc_char* > TextMap;
	TextMap tmap;

	typedef std::vector< xgc_int16 > Sequence;
	typedef std::map< xgc_uint32, Sequence > AniBlockMap;
	typedef std::map< std::string, std::pair< HTEXTURE, AniBlockMap > > AnimationMap;

	AnimationMap amap;

private:
	hgeSprite* CreateSprite( const LodEntry& entry, xgc_byte* uncompressed );
	hgeAnimation* CreateAnimation( const LodEntry& entry, xgc_byte* uncompressed );
	xgc_char* CreateText( const LodEntry& entry, xgc_byte* uncompressed );
};
